package com.sfac.springBoot.modules.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sfac.springBoot.modules.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * @Description Student
 * @Author HymanHu
 * @Date 2022/7/1 13:52
 */
@Entity
@Table(name = "test_student")
public class Student extends AbstractEntity {

	private String studentName;
	private int age;

	@OneToOne(targetEntity = Card.class, cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "card_id", unique = true)
	private Card card;

	@ManyToMany(mappedBy = "students", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JsonIgnore
	private List<Clazz> clazzes;

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public Card getCard() {
		return card;
	}

	public void setCard(Card card) {
		this.card = card;
	}

	public List<Clazz> getClazzes() {
		return clazzes;
	}

	public void setClazzes(List<Clazz> clazzes) {
		this.clazzes = clazzes;
	}
}
